﻿using System;
using System.Runtime.Serialization;

namespace BJoin.Application.AppException
{
    [Serializable]
    public class HttpStatusCodeException : Exception
    {
        public int StatusCode { get; set; }
        public string ContentType { get; set; } = @"text/html;charset=utf-8";

        public HttpStatusCodeException(int statusCode)
        {
            this.StatusCode = statusCode;
        }

        public HttpStatusCodeException(int statusCode, string message) : base(message)
        {
            this.StatusCode = statusCode;
        }

        public HttpStatusCodeException(int statusCode, Exception inner) : this(statusCode, inner.ToString()) { }

        public HttpStatusCodeException()
        {
        }

        public HttpStatusCodeException(string message) : base(message)
        {
        }

        public HttpStatusCodeException(int statusCode,string message, Exception innerException) : base(message, innerException)
        {
            this.StatusCode = statusCode;
        }

        protected HttpStatusCodeException(SerializationInfo serializationInfo, StreamingContext streamingContext):base(serializationInfo,streamingContext)
        {
        }

        public HttpStatusCodeException(string message, Exception innerException) : base(message, innerException)
        {
        }
    }
}
